#include <bits/stdc++.h>

#define in read()

using namespace std;

using ll = long long;

const int N = 1 << 20;
const int mod = 998244353;
const int inv2 = (mod + 1) / 2;

int a[N],b[N],n,len;
ll V;

int upd(int x) { return x + (x >> 31 & mod); }

void FWT(int *f) {
	for(int h = 2;h <= len;h <<= 1) {
		for(int i = 0;i < len;i += h) {
			for(int j = i;j < i + h / 2;j++) {
				int u = f[j],v = f[j + h / 2];
				f[j] = upd(u + v - mod); f[j + h / 2] = upd(u - v);
			}
		}
	}
}

void IFWT(int *f) {
	for(int h = 2;h <= len;h <<= 1) {
		for(int i = 0;i < len;i += h) {
			for(int j = i;j < i + h / 2;j++) {
				int u = f[j],v = f[j + h / 2];
				f[j] = (ll) upd(u + v - mod) * inv2 % mod; f[j + h / 2] = (ll) upd(u - v) * inv2 % mod;
			}
		}
	}
}

void mul(int *a,int *b,int *c) { for(int i = 0;i < len;i++) c[i] = (ll) a[i] * b[i] % mod; }

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	auto sg = [] (int x) { for(int l = 1,s = 1;;l <<= 1,s += l) if(s >= x) return x - (s - l); assert(0); }; 
	cin >> V >> n; int mx = 0;
	for(int i = 1,x;i <= n;i++) x = sg(i),a[x]++,mx = max(mx,x);
	b[0] = 1; for(len = 1;len <= mx;len <<= 1); FWT(a); FWT(b);
	for(;V;V >>= 1,mul(a,a,a)) if(V & 1ll) mul(a,b,b);
	IFWT(b);
	int ans = 0;
	for(int i = 1;i < len;i++) ans = upd(ans + b[i] - mod);
	printf("%d\n",ans);
	return 0;
}
